package com.aos.erp.schools.service.common.impl;

import com.aos.erp.schools.mapper.common.DictMapper;
import com.aos.erp.schools.model.common.Dict;
import com.aos.erp.schools.model.common.Region;
import com.aos.erp.schools.service.common.DictService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @program: erp
 * @description: 数据字典
 * @author: tanzhiyu
 * @create: 2018-11-09 19:19
 **/
@Service
public class DictServiceImpl extends ServiceImpl<DictMapper, Dict> implements DictService {
    @Resource
    private DictMapper dictMapper;

    public List<Dict> findByParams(String code){
        Map<String, Object> map=new HashMap<>();
        map.put("code",code);
        List<Dict>  list= dictMapper.findByParams(map);
        if(list==null || list.size()==0){
            return  null;
        }
        Dict dict=list.get(0);
        map=new HashMap<>();
        map.put("parentId",dict.getId());
        list= dictMapper.findByParams(map);
        return list;
    }

}
